<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<html>
<script>
	var ctx = "${ctx}";
</script>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>发布优惠券</title>

	<meta charset="utf-8">
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	<link href="http://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.2/summernote.css" rel="stylesheet" >
	<link href="${ctx}/static/css/bootstrap.css?v=${static_version}/" rel="stylesheet">
	<link href="${ctx}/static/css/font-awesome.min.css" rel="stylesheet" />
	<link href="${ctx}/static/css/animate.min.css?v=${static_version}" rel="stylesheet" />
	<link href="${ctx}/static/css/style.min.css?v=${static_version}" rel="stylesheet" />
	<link href="${ctx}/static/css/common.css?v=${static_version}" rel="stylesheet" />
	<link href="//at.alicdn.com/t/font_9x03jhokyws9vn29.css" rel="stylesheet">
	<!-- 插件样式  -->
	<link href="${ctx}/static/css/plugins/dataTables/dataTables.bootstrap.css" rel="stylesheet" />
	<link href="${ctx}/static/css/plugins/webuploader/webuploader.css" rel="stylesheet" />
	<link href="${ctx}/static/css/plugins/markdown/bootstrap-markdown.min.css" rel="stylesheet" />
	<link href="${ctx}/static/css/plugins/datapicker/datepicker3.css" rel="stylesheet">
	<link href="${ctx}/static/plugins/region/css/city-picker.css" rel="stylesheet" type="text/css" />

<title>新增优惠券</title>
</head>
<body class="gray-bg">
	<div class="wrapper wrapper-content  animated fadeInRight">
	   	<div class="ibox float-e-margins">
	   		<div class="ibox-content">
	    <form class="form form-horizontal"  id="coupon_table_form" method="post" action="${ctx}/coupon-add">	
		<input type="hidden" id="coupon_id" name="coupon_id" value='${u_coupon.coupon_id}' />
		
        <div class="row">
	       	<div class="form-horizontal">	       
				<div class="form-group">
		   	 	<label class="col-sm-2 control-label">优惠券分类：</label>
						
				<div class="col-sm-10">
					<div class="col-sm-4 m-l-n">
		
					 <select name="coupon_cate_id" class="form-control"  datatype="*" nullmsg="不能为空">
						<c:forEach items="${match_classifys_list}" var="classifys">
							<option value="${classifys.item_value}" 
								<c:if test="${u_coupon.coupon_cate_id==classifys.item_value}">selected</c:if>>${classifys.display_name}
							</option>					
						</c:forEach>
					</select>
					</div>
				</div>
			</div>
			
		 <div class="form-group">
            <label class="col-sm-2 control-label" >公司名称：</label>
            <div class="col-sm-10">
            	<div class="col-sm-4 m-l-n">
             		<input type="text" class="form-control" value="${u_coupon.corp_name}" placeholder="" id="corp_name" name="corp_name" datatype="*" nullmsg="不能为空">
             	</div>
            </div>
        </div>
        

		
		<div class="form-group">
			<label class="col-sm-2 control-label" >公司位置：</label>
			 <div class="col-sm-10">
            	<div class="col-sm-4 m-l-n">
			 	<input id="city-picker3" class="form-control" 
					name="regioninfo" type="text" value="<c:if test="${u_coupon.province!=''}">${u_coupon.province}</c:if><c:if test="${u_coupon.city!=''}">/${u_coupon.city}</c:if><c:if test="${u_coupon.area!=''}">/${u_coupon.area}</c:if>" data-toggle="city-picker">
 												
				<input type="text" class="form-control" value="${u_coupon.corp_adress}"
						placeholder="详细地址"  name="corp_adress" nullmsg="不能为空">
			</div>
		</div>	
		</div>
		
		
		<div class="form-group">
            <label class="col-sm-2 control-label" >联系电话：</label>
            <div class="col-sm-10">
            	<div class="col-sm-4 m-l-n">
             		<input type="text" class="form-control" value="${u_coupon.corp_mobile}" placeholder="" name="corp_mobile" id="corp_mobile"  datatype="*" nullmsg="不能为空">
             	</div>
            </div>
        </div>
						
		<div class="form-group">
            <label class="col-sm-2 control-label" >营业时间：</label>
            <div class="col-sm-10">
            	<div class="col-sm-4 m-l-n">
             		<input type="text" class="form-control" value="${u_coupon.business_hours}" placeholder="" name="business_hours" id="business_hours"  datatype="*" nullmsg="不能为空">
             	</div>
            </div>
        </div>
		


		<div class="form-group">
			<label class="col-sm-2 control-label">优惠类型：</label>
            <div class="col-sm-10">
            <div class="col-sm-4 m-l-n">
	                <select name="coupon_type" class="form-control" datatype="*" nullmsg="不能为空">					
						<c:forEach items="${match_preferentias_list}" var="preferentias">
							<option value="${preferentias.item_value}" 
								<c:if test="${u_coupon.coupon_type==preferentias.item_value}">selected</c:if>>${preferentias.display_name}
							</option>					
						</c:forEach>
					</select>
        	</div>
			</div>
		</div>
		
	<%-- 	<div class="form-group">
			<label class="col-sm-2 control-label">投放范围：</label>
              <div class="col-sm-10">
            <div class="col-sm-4 m-l-n">
                <input type="text" class="form-control" value="${u_coupon.range}" placeholder="填写数字" id="range" name="range" datatype="n" nullmsg="不能为空">
        	</div>
		</div>
		</div> --%>
		
		<div class="form-group">			
			<label class="col-sm-2 control-label">投放范围：</label>
			<div class="col-sm-8">
				<div class="form-group">
					<div class="col-sm-2">
						<input type="text" class="form-control"
							value="${u_coupon.corp_longitude}" placeholder="经度"
							readonly="readonly" id="longitude" name="longitude">
					</div>
					<div class="col-sm-2">
						<input type="text" class="form-control"
							value="${u_coupon.corp_latitude}" placeholder="纬度"
							readonly="readonly" id="latitude" name="latitude">
					</div>
					<div class="col-sm-1">
						<a href="javascript:;" class="btn btn-primary radius"
							onclick="getlnglat()">定位</a>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-1 control-label">范围</label>
					<div class="col-sm-2">
						<input type="text" class="form-control"
							value="${u_coupon.range}" placeholder="米"
							id="range" name="range">
					</div>
				</div>
			</div>
		</div>
		

      	<div class="form-group">
			<label class="col-sm-2 control-label">优惠券说明：</label>
			<input type="hidden" id="description" name ="description" >
			
			   <div class="col-sm-10">
            <div class="col-sm-4 m-l-n">
		 		<div id="summernote" class="form-control">${u_coupon.description}</div>
		 	</div>
		 	</div>
		</div> 
		
		
        <div class="form-group">
				<label class="col-sm-2 control-label">优惠金额</label> 
				<label class="col-sm-2 control-label">
					<button
						onClick="add_new_charge();" class="btn btn-primary radius"
						type="button">
						添加
					</button>
				</label> 
				<label class="col-sm-2 control-label"></label>
			</div>

	        <div class="form-group">
	       		<label class="col-sm-12">
					<table id="charge" class="table">
						<thead>
							<tr>
								<th class="col-xs-1">#</th>
								<th class="col-xs-3">优惠金额</th>
								<th class="col-xs-1">使用条件</th>
								<th class="col-xs-2">数量（张）</th>
								<th class="col-xs-2">有效期至</th>
								<th class="col-xs-1"></th>
							</tr>
						</thead>
						<tbody>
							<c:forEach items="${apiU_coupon}" var="coupon_info">
								<tr>
									<input type="hidden" id="coupon_id_list" name="coupon_id_list" value='${coupon_info.coupon_id}' />
									<td class='col-xs-1'></td>
									<td class='col-xs-3'><input type='text'
										class='form-control' style='min-width: 10px'
										name='coupon_amout'  nullmsg='不能为空并且不得超过50个字符'
										value="${coupon_info.coupon_amout}"></td>
									<td class='col-xs-1'><input type='text'
										class='form-control' style='min-width: 10px' name='use_limit1'
										value="${coupon_info.use_limit1}"></td>
									<td class='col-xs-2'><input type='text'
										class='form-control' style='min-width: 10px'
										name='coupon_count' datatype='n1-10' nullmsg='不能为空并且必须是整数'
										value="${coupon_info.coupon_count}"></td>
									<td class="col-xs-2">
										<input type="text"  name="end_time" value="${coupon_info.end_time}" class="input-md form-control layer-date" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})">	
									</td>	
										
									<td class='col-xs-1'><button
											class='btn btn-primary radius' type='button' onClick="coupon_disable(this)">											 
											删除
										</button></td>
								</tr>
							</c:forEach>
						</tbody>
					</table>
				</label>
			</div>
			<div class="form-group">
				<div class="col-sm-4 col-sm-offset-2">
					<button onClick="u_coupon_save_submit();"
						class="btn btn-primary radius col-sm-2 " type="submit">
						 保存
					</button>
					&nbsp;&nbsp;
					<button class="btn btn-white" type="button" onclick="layer_close()">取消</button>
				</div>
			</div>	
		</div>
		</div>
	</form>
</div>
</div>
</div>

<script src="${ctx}/static/js/uthinkjs/jquery.js"></script>
	<script src="${ctx}/static/js/bootstrap.min.js"></script>
	<script src="${ctx}/static/js/uthinkjs/summernote.js"></script>
	<!-- 插件脚本 -->
	<script src="${ctx}/static/js/plugins/layer/layer.js"></script>	
	<script src="${ctx}/static/js/jquery.form.js"></script>
	<script src="${ctx}/static/js/plugins/webuploader/webuploader.min.js"></script>
	<script src="${ctx}/static/js/plugins/validate/jquery.validate.min.js"></script>
	<script src="${ctx}/static/js/Validform/5.3.2/Validform.min.js"></script>
	<script src="${ctx}/static/js/plugins/dataTables/jquery.dataTables.js"></script>
	<script src="${ctx}/static/js/plugins/dataTables/dataTables.bootstrap.js"></script>	
	<script src="${ctx}/static/js/plugins/validate/messages_zh.min.js?v=${static_version}"></script>
	
    	<!-- 地区控件资源 -->
	<script type="text/javascript"
		src="${ctx}/static/plugins/region/js/city-picker.data.js"></script>
	<script type="text/javascript"
		src="${ctx}/static/plugins/region/js/city-picker.js"></script>
	<script type="text/javascript"
		src="${ctx}/static/plugins/region/js/main.js"></script>
	<script
		src="${ctx}/static/js/plugins/datapicker/bootstrap-datepicker.js"></script>
	<script src="${ctx}/static/js/My97DatePicker/WdatePicker.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/uthinkjs/u_coupon.js"></script>

<script type="text/javascript">

$(document).ready(function(){	
	$('#summernote').summernote({
		height: 150
	});
});

var ctx = '${ctx}';
</script>
</body>
</html>

